@extends("public.main")
@section("content")
    <div style="margin-left:200px;">
        <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 分类管理 <span
                    class="c-gray en">&gt;</span>添加文章
        </nav>
        <form class="form form-horizontal form-o2o-add" id="form-o2o-add" method="post"
              action="/admin/article/add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章名称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="{{ old('title') }}" placeholder="" id="title" name="title">
                    @if($errors->has('title'))
                        <a style="color:red">{{ $errors->first('title') }}</a>
                    @endif
                    {!!csrf_field()!!}
                </div>
            </div>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章分类：</label>
                <div class="formControls col-xs-8 col-sm-3">
                    <select name="category_id" class="select">
                        <option value="0">一级分类</option>
                        @foreach($data as $k => $v)
                            <option value="{{$v['id']}}">---{{$v['name']}}</option>
                        @endforeach
                    </select>
                    {!!csrf_field()!!}
                </div>
            </div>
            <div class="row cl">

            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>文章内容：</label>
                <div id="div1" class="toolbar">
                </div>
            </div>
            <div class="row cl">

                <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span></label>
                <div id="div2" class="text"  > <!--可使用 min-height 实现编辑区域自动增加高度-->

                </div>
            </div>
            <div class="row cl"></div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    @if($errors->has('content'))
                        <a style="color:red">{{ $errors->first('content') }}</a>
                    @endif
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button type="submit" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe632;</i> 保存
                    </button>
                    <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
            </div>
        </form>
    </div>
    <style type="text/css">
        .toolbar {
            border: 1px solid #ccc;
            width:60%;
        }
        .text {
            border: 1px solid #ccc;
            height: 400px;
            margin-left: 17%;
            width:60%;
        }
    </style>
    <script type="text/javascript">
        var E = window.wangEditor
        var editor = new E('#div1', '#div2')    // 两个参数也可以传入 elem 对象，class 选择器
        editor.customConfig.uploadImgServer = '/upload'
        editor.create()
    </script>
@endsection


